import 'package:base_flutter/base_flutter.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:ls_work/message/message_config.dart';
import 'package:ls_work/model/food/food_record_model.dart';

import '../../net/response/food/old_food_order_response.dart';

class OldOrderFoodDetailViewModel extends BaseListViewModel<OldFoodOrderListData>{
  final String oldId ;

  var model = FoodRecordModel();
  OldOrderFoodDetailViewModel(BuildContext context,this.oldId) : super(context);



  var packageInfo = "";

  @override
  Future<List<OldFoodOrderListData>> requestListData() async {
    var data = await model.getOldOrderDetail(oldId);
    packageInfo = data.data?.packageConfName??"";
    return data.data?.list??[];
  }

  @override
  void onCreated() {
    super.onCreated();
    requestRefresh();
  }

  @override
  void receiveMessage(SendMessageEvent event) {
    super.receiveMessage(event);
    if(event.msgCode==MessageConfig.PAY_FOOD_SUCCESS){
      requestRefresh();
    }
  }

}